﻿
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>计划库存</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/js/layui/css/layui.css" rel="stylesheet" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    @* <script src="~/js/layui/layui.js"></script> *@
    @* <script src="~/X-admin/lib/layui/layui.all.js"></script> *@
    <script src="~/X-admin/lib/layui/layui.js"></script>
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>
    <script src="~/Scripts/formSelect/multiSelect.js"></script>
    <script src="~/js/framework/commonjs.js"></script>
</head>
<body>
    <ul lay-bar="disabled" class="mWebBanner">

        <li class="layui-nav-item" style="float:left;margin-left:1%">
            <button type="button" onclick="closeWin()" class="buttonCss">
                <i class="layui-icon" style="margin-right:3px">&#x1007;</i>关闭页面
            </button>
        </li>
    </ul>
    <div class="layui-card" style="margin-top:1%;padding-top:2%">
        <div class="layui-card-body layui-table-body" id="layui-table-main">
            <table class="layui-hide" id="list" lay-filter="list"></table>
        </div>
    </div>

</body>
</html>
<script type="text/html" id="barDemo">
    <a title="删除" href="javascript:;" lay-event="del" ><i class="layui-icon">&#xe640;</i></a>
</script>

<script>
    // var webCode = "";
    var dataId = "";
    $(function () {
        dataId = getUrlVariable("dataId");
        loadData();
    })



    var currPage = "1";
    var cData = new Array();

    function loadData() {
        layui.use('table', function () {
            var obj = {
            dataId:dataId
            }
            var table = layui.table;
            table.render({
                elem: '#list'
                , cols: [[
                      { field: 'createuser', title: '用户账号', width: 130 }
                    , { field: 'userName', title: '用户名称', width: 120 }
                    , { field: 'number', title: '数 量', width: 110 }
                    , { field: 'createtime', title: '创建时间', width: 160 }
                    , { field: 'right', align: 'center', title: '数据操作', toolbar: '#barDemo', width: 120, fixed: 'right' }
                ]], done: function (res, curr, count) {
                    currPage = curr;
                  
                }
                , url: "../Plan/GetDataList?dataType=ppml&condition=" + JSON.stringify(obj)
                , skin: 'row' //表格风格
                , even: true
                , page: false //是否显示分页
                , limits: [10, 20, 30]
                , limit: 10 //每页默认显示的数量
            });
            //监听工具条
            table.on('tool(list)', function (obj) {
                var data = obj.data; //当前行旧数据
     
                if (obj.event == 'del') {
                    layer.confirm('确定要删除选中数据？', function (index) {
                        var rsl = DelData(data.id);
                        if (rsl.result) {
                            obj.del();
                            layer.msg("删除成功", {icon:1});
                        } else {
                            layer.msg(info.message, { icon: 2 });
                        }
                        layer.close(index);

                    });
                } 

            });

     
        });
    }

    function DelData(dataId) {
        var info = undefined;
        $.ajax({
            url: "../Plan/DelPPMList",
            data: { dataId: dataId },
            dataType: "json",
            type: "POST",
            async: false,
            success: function (data) {

                info = data;
            }
        });
        return info;
    }
</script>

